import request from '@/utils/request'

// 获取配置
export function settingGetInfo(id) {
  return request({
    url: `/manager/setting/getInfo/${id}`,
    method: 'get'
  })
}

// 更新配置
export function putSetting(data) {
  return request({
    url: '/manager/setting',
    method: 'put',
    data
  })
}

// 获取设备列表
export function getDeviceList(params) {
  return request({
    url: '/manager/device/ai/deviceList',
    method: 'get',
    params
  })
}

// 设备列表
export function getAliasList(params) {
  return request({
    url: '/manager/device/ai/aiAliasList',
    method: 'get',
    params
  })
}

// 获取系统列表
export function getSystemList(params) {
  return request({
    url: '/manager/device/systemList',
    method: 'get',
    params
  })
}

// 添加修改ai识别名字
export function saveOrUpdateAiName(data) {
  return request({
    url: '/manager/device/saveOrUpdateAiName',
    method: 'post',
    data
  })
}

// 客户楼栋列表
export function buildingDrawingList(params) {
  return request({
    url: '/manager/building/drawingList',
    method: 'get',
    params
  })
}

// 客户楼栋列表
export function imageListBuild(buildingId) {
  return request({
    url: `/manager/building/image/list/${buildingId}`,
    method: 'get'
  })
}


// 更新建筑楼层图纸
export function putBuildingImage(data) {
  return request({
    url: `/manager/building/image`,
    method: 'put',
    data
  })
}

// 新增建筑楼层图纸
export function postBuildingImage(data) {
  return request({
    url: `/manager/building/image`,
    method: 'post',
    data
  })
}
// 获取建筑楼层图纸详细
export function getBuildingImageDetail(id) {
  return request({
    url: `/manager/building/image/${id}`,
    method: 'get'
  })
}
// 删除建筑楼层图纸
export function delBuildingImage(id) {
  return request({
    url: `/manager/building/image/${id}`,
    method: 'delete'
  })
}


// 批量下载建筑楼层图纸
export function imageZipDown(ids) {
  return request({
    url: `/manager/building/image/zip/${ids}`,
    method: 'post',
    responseType: 'blob',
  })
}

// 请求AI识别设备列表
export function postAiPredict(data) {
  return request({
    url: `/manager/building/image/ai/predict`,
    method: 'post',
    data,
    timeout: 1000 * 60 * (data.cache ? 1 : data.files.length)
  })
}


// 删除AI识别设备
export function deleteAiPredict(data) {
  return request({
    url: `/manager/building/image/ai/delete`,
    method: 'post',
    data
  })
}

// 获取AI识别设备统计
export function getAiPredictCount(buildingId) {
  return request({
    url: `/manager/building/image/ai/importPreviewData/${buildingId}`,
    method: 'get'
  })
}

// 保存AI识别设备
export function saveAiPredict(buildingId) {
  return request({
    url: `/manager/building/image/ai/saveData/${buildingId}`,
    method: 'post',
  })
}

// 修改AI识别设备
export function updatePredict(data) {
  return request({
    url: `/manager/building/image/ai/update`,
    method: 'post',
    data
  })
}

// 获取导入日志列表
export function getAiLogList(params) {
  return request({
    url: `/manager/ai/log/list`,
    method: 'get',
    params
  })
}

// 获取日志详情
export function getAiLogInfo(params) {
  return request({
    url: `/manager/ai/log/getInfo`,
    method: 'get',
    params
  })
}